{% extends 'teacher_base.html' %}

{% block context %}
    <div>
        <div class="bd-example">
        <table class="table table-striped" style=" text-align: center;margin:0 150px;width: 80%">
          <thead>
          <tr>
            <th scope="col">#</th>
            <th scope="col">学号</th>
            <th scope="col">姓名</th>
            <th scope="col">操作</th>
          </tr>
          </thead>
          <tbody>

              {% for student in students %}
            <tr>
                <th scope="row">{{ forloop.counter }}</th>
                <td>{{ student.number }}</td>
                <td>{{ student.name }}</td>
                {% if student.inputPaper %}
                    {% if student.total_score == 0 %}
                        <td><a href="{% url 'teacher:markpaper' stu_id=student.number %}">阅卷</a></td>
                        {% else %}
                        <td>{{ student.total_score }}分</td>
                    {% endif %}

                {% else %}
                    <td><a href="{% url 'teacher:delcoursestu' name=course num=student.number %}">删除该生</a>
                {% endif %}

            </tr>
          {% endfor %}
            <tr>
                <td  align="center"><a class="btn btn-sm btn-outline-secondary" href="{% url 'teacher:addstu' %}?course={{ course }}">添加学生</a></td>
                <td  align="center"><a class="btn btn-sm btn-outline-secondary" href="{% url 'teacher:download' %}?course_name={{ course }}">下载成绩单</a></td>
                <td colspan="2" align="center"><a class="btn btn-sm btn-outline-secondary" href="{% url 'teacher:delcourse' teacher_name=teacher course_course=course %}">删除该课</a></td>
            </tr>

          </tbody>
        </table>
        </div>
 </div>
{% endblock %}